import request from "@/netword/request";


const fun = {};


// 分页查询所有信息
fun.getList = async (link) => {
    const res = await request({
        url: "/a/content/link/list",
        method: "post",
        params: {
            linkName: link.linkName,
            pageNo: link.pageNo,
            pageSize: link.pageSize,
        }
    })
    return res.data;
}



//保存数据
fun.saveLink = async (link) => {
    const res = await request({
        url: "/a/content/link/save",
        method: "put",
        params: {
            linkName: link.linkName,
            linkAddress: link.linkAddress,
            linkIcon: link.linkIcon,
            sort: link.sort,
            remarks: link.remarks,
        }
    })
    return res.data;
}



//更新数据
fun.updateLink = async (link) => {
    const res = await request({
        url: "/a/content/link/update",
        method: "post",
        params: {
            id: link.id,
            linkName: link.linkName,
            linkAddress: link.linkAddress,
            linkIcon: link.linkIcon,
            sort: link.sort,
            remarks: link.remarks,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/content/link/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getLink = async (id) => {
    const res = await request({
        url: "/a/content/link/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}


export default fun;